# coding:utf-8
# __ahtu__ = 'Felix'

import requests


class Http():

    def get(self,*args,**krags):
        try:
            rep = requests.get(*args,**krags)
        except Exception as error_msg:
            print(error_msg)
        finally:
            # 如果有返回结果
            if rep:
                # 如果http的响应不为200，则为通讯异常，记录异常结果
                if rep.status_code != '200':
                    print(rep.status_code)
                else:
                    return rep

    def post(self,*args,**krags):
        try:
            rep = requests.post(*args,**krags)
        except Exception as error_msg:
            print(error_msg)
        finally:
            # 如果有返回结果
            if rep:
                # 如果http的响应不为200，则为通讯异常，记录异常结果
                if rep.status_code != '200':
                    print(rep.status_code)
                else:
                    return rep



if __name__ == '__main__':
    Http().get(url='http://www.baidu.com/')